package com.lucifer.hawkeye.ai.vector;
import org.springframework.ai.document.Document;
import org.springframework.ai.vectorstore.SearchRequest;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.lang.Nullable;
import java.util.List;


/**
 * @author lucifer
 * @date 2025/3/28 17:51
 */

public class HawkeyeVectorStoreEngine implements VectorStoreEngine {

    private final VectorStore vectorStore;

    @Override
    public void add(List<Document> documents) {
        vectorStore.add(documents);
    }

    @Override
    public void delete(List<String> idList) {
        vectorStore.delete(idList);

    }

    @Override
    public List<Document> similaritySearch(SearchRequest searchRequest) {
        return vectorStore.similaritySearch(searchRequest);
    }


    public HawkeyeVectorStoreEngine(VectorStore vectorStore) {
        this.vectorStore = vectorStore;
    }


    public static Builder builder() {
        return new Builder();
    }

    public static final class Builder {

        @Nullable
        private VectorStore vectorStore;

        private Builder() {
        }

        public Builder vectorStore(VectorStore vectorStore) {
            this.vectorStore = vectorStore;
            return this;
        }

        public HawkeyeVectorStoreEngine build() {
            return new HawkeyeVectorStoreEngine(this.vectorStore);
        }
    }










}
